﻿{% extends "gma/base.html" %}

<!-- CONTENT
  =====================================================================-->

{% block content %}

<div class="page__hd">
    <h1 class="page__title">
        <i class="fa fa-landmark weui_grid_icon_fa" style="font-size: 32px"> </i> {{ guild.guild_name }}
    </h1>
    <p class="page__desc"> 成立时间: {{ guild.create_time|date:"Y-m-d" }} </p>
</div>

<div class="page__bd">

    <div class="weui-cells__title">新增成员ID列表</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea class="weui-textarea" id="members_uids" placeholder="请输入需要加入的成员uid, 多个uid之间可以使用换行符分隔" rows="10"></textarea>
{#                <div class="weui-textarea-counter"><span>0</span>/200</div>#}
            </div>
        </div>
    </div>
</div>

<div class="weui-btn-area">
    <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:add_guild_members()"> <i class="fa fa-plus-square"></i> 增加成员 </a>
</div>

<div class="page__ft j_bottom">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>

{% endblock content %}

<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}
<script>

function add_guild_members() {
    const members_uids = $('#members_uids').val();
    if (!members_uids) {
        alert("无效的成员id");
        return;
    }

    let url = '{% url 'gma:api_recruit_guild_members' %}';
    let data = {
        'guild_id': {{ guild.id }},
        'uids': members_uids,
    };
    new my_ajax(url, data, '', '', () => {
        show_toast('添加成功');
    });
}

</script>
{% endblock extra_js %}